//
// Created by liuyang on 15-9-12.
//

#ifndef GRAPH_STACK_H
#define GRAPH_STACK_H

#include <exception>

template <class E>
class Stack{
private:
    E arr[100];
    int count;
public:
    Stack():count(0){};

    int getCount(){
        return count;
    }

    int isEmpty(){
        if(count == 0) return true;
        else return false;
    }

    void push_back(E a){
        if(count < 99){
            arr[count] = a;
            count++;
        } else {
            std::exception e;
            throw e;
        }
    }

    E pop_back(){
        if(count > 0){
            count--;
            return arr[count];
        } else {
            std::exception a;
            throw a;
        }
    }

};

#endif //GRAPH_STACK_H
